﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HR_Interface;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels;
namespace HR_Client
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        IEmployee iEmp = null;
        private void btn_connect_Click(object sender, EventArgs e)
        {
            try
            {
                TcpChannel tcp = new TcpChannel();
                String url = "tcp://" + txt_ip.Text + ":" + txt_port.Text + "/EmployeeRemotingObject";
                iEmp = (IEmployee)Activator.GetObject(typeof(IEmployee), url);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            toolStripLabel1.Text = "Connect success";
        }

        private void btn_search_Click(object sender, EventArgs e)
        {
            if (rd_qualifition.Checked)
                gv_employee.DataSource = iEmp.searchEmployeeByQualification(txt_quatification.Text);
            else
                gv_employee.DataSource = iEmp.getAllEmployee();
        }

      

        private void rd_qualifition_CheckedChanged_1(object sender, EventArgs e)
        {
            if (rd_qualifition.Checked)
                txt_quatification.ReadOnly = false;
        }
    }
}
